/**
 * Copyright (C) 2025 pony working team
 * SPDX-License-Identifier: MulanPSL-2.0
 */

/* includes (local) ----------------------------------------------------------*/
/* includes (standard library, system) ---------------------------------------*/
/* includes (other library) --------------------------------------------------*/
/* includes (project) --------------------------------------------------------*/
#include <x_config.h>
#include <x_compiler.h>

/* defines -------------------------------------------------------------------*/
/* typedefs ------------------------------------------------------------------*/
/* macro ---------------------------------------------------------------------*/
/* variables (global) --------------------------------------------------------*/
/* variables (extern) --------------------------------------------------------*/
/* variables (local) ---------------------------------------------------------*/
/* inlines -------------------------------------------------------------------*/
/* functions -----------------------------------------------------------------*/

extern void reset_handler(void);
extern void exc_handler(void);
extern void svc_handler(void);
extern void pendsv_handler(void);
extern void systick_handler(void);
extern void irq_handler(void);

/* msp (1) + system exception (15) + interrupt (n) */
__section__(vectors) __unused void (*const _vectors[])(void) = {
    NULL,          /* MSP initial value */
    reset_handler, /* reset        */
    exc_handler,   /* NMI          */
    exc_handler,   /* HardFault    */
#ifdef CONFIG_CORTEX_M_BASELINE
    NULL,
    NULL,
    NULL,
#else
    exc_handler, /* MemManage    */
    exc_handler, /* BusFault     */
    exc_handler, /* UsageFault   */
#endif
    NULL,
    NULL,
    NULL,
    NULL,
#ifdef CONFIG_SVC
    svc_handler, /* SVCall       */
#else
    exc_handler, /* SVCall       */
#endif
#ifdef CONFIG_CORTEX_M_BASELINE
    NULL,
#else
    exc_handler, /* DebugMonitor */
#endif
    NULL,
    pendsv_handler,  /* PendSV       */
    systick_handler, /* SysTick, NA  */

#if CONFIG_NR_IRQS != 0
    [16 ... 16 + CONFIG_NR_IRQS - 1] = irq_handler,
#endif
};
